Repository navigation
Conversation
A lot of new setups, many of them written by AI coding agents, configure tracing but set traces_sample_rate to 0, often through a setting or environment variable that defaults to 0 and is never set. The SDK then instruments every request, starts no traces and sends no performance data, and nothing tells anyone. Most of these setups stay that way. Warn at init when traces_sample_rate is 0 and no traces_sampler is set. It uses warnings.warn rather than the SDK logger, because the logger only writes when debug is on. The message says how to send traces, and that the warning can be hidden with warnings.filterwarnings when 0 is intentional (for example, to only continue traces sampled upstream). There's no warning when traces_sample_rate isn't set, is None, or is above 0, or when a traces_sampler is set. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Coverage Results 📊✅ 139324 passed | ⏭️ 7861 skipped | Total: 147185 | Pass Rate: 94.66% | Execution Time: 426m 47s 📊 Comparison with Base Branch
All tests are passing successfully. ✅ Patch coverage is 100.00% (2 of 2 changed executable lines covered; target 80%). Changed files with executable lines (1)
Coverage diff@@ Coverage Diff @@
## master #8269 +/-##
==========================================
Coverage 90.21% 90.21% —%
==========================================
Files 203 203 —
Tracked lines 27335 27337 +2
Branches 10246 10248 +2
==========================================
+ Hits 24660 24661 +1
- Misses 2675 2676 +1
- Partials 1560 1561 +1Generated by Coverage Action |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Warn at init when
traces_sample_rateis 0 and notraces_sampleris set.Many new setups, a lot of them written by AI coding agents, turn tracing on but set the sample rate to 0, usually through a setting that defaults to 0 and never gets set. These apps send no traces, nothing tells anyone, and most of them stay that way. The warning tells the developer, or the agent running the app, that no traces will be sent and how to fix it.
It only shows when the rate is explicitly 0. People who want 0 on purpose, for example to only continue traces sampled upstream, can hide it.
This is a draft to get opinions on the idea. Please don't merge it.
Issues
None.
🤖 Generated with Claude Code